import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'

// 公共路由 - 不需要登录即可访问
const homeRoutes = [
    {
        path: '/',
        name: 'home',
        component: () => import('@/pages/home/App.vue'),
        meta: {
            title: '首页',
            requiresAuth: false
        }
    },
    {
        path: '/inservices',
        name: 'innovative_services_page',
        component: () => import('@/pages/innovative_services_page/App.vue'),
        meta: {
            title: '创新服务门户',
            requiresAuth: false
        }
    },
]
const emplatRoutes = [
    {
        path: '/emplat',
        name: 'empowerment_platform_page',
        component: () => import('@/pages/empowerment_platform_page/App.vue'),
        meta: {
            title: '赋能平台',
        },
    },{
        path: '/intellComput',
        name: 'intell_comput_page',
        component: () => import('@/pages/intell_comput_page/App.vue'),
        meta: {
            title: '智算中心',
        }
    }, {
        path: '/knowhub',
        name: 'know_hub_page',
        component: () => import('@/pages/know_hub_page/App.vue'),
        meta: {
            title: '知识中枢',
            requiresAuth: false
        }
    }, {
        path: '/modelhub',
        name: 'model_hub_page',
        component: () => import('@/pages/model_hub_page/App.vue'),
        meta: {
            title: '模型中枢',
            requiresAuth: false
        }
    }, {
        path: '/applicationscen',
        name: 'application_scen_page',
        component: () => import('@/pages/application_scen_page/App.vue'),
        meta: {
            title: '场景应用中心',
            requiresAuth: false
        }
    },
]
const newsConsultationRoutes = [
    {
        path: '/newsConsultation',
        name: 'news_consultation_page',
        component: () => import('@/pages/news_consultation_page/App.vue'),
        meta: {
            title: '新闻资讯',
            requiresAuth: false
        }
    },
]
const leadershipCareRoutes = [

    {
        path: '/leadershipCare',
        name: 'leadership_care_page',
        component: () => import('@/pages/leadership_care_page/App.vue'),
        meta: {
            title: '领导关怀',
            requiresAuth: false
        }
    },
]
const servicecapaRoutes = [
    {
        path: '/servcapa',
        name: 'serv_capa_page',
        component: () => import('@/pages/serv_capa_page/App.vue'),
        meta: {
            title: '服务能力',
            requiresAuth: false
        },
    },
    {
        path: '/servicecapa',
        name: 'service_capability_page',
        component: () => import('@/pages/service_capability_page/App.vue'),
        meta: {
            title: '服务能力',
            requiresAuth: false
        },
    },{
        path: '/netmarket',
        name: 'net_market_page',
        component: () => import('@/pages/net_market_page/App.vue'),
        meta: {
            title: '互联网营销服务',
            requiresAuth: false
        }
    }, {
        path: '/brand_details',
        name: 'brand_detail_page',
        component: () => import('@/pages/brand_detail_page/App.vue'),
        meta: {
            title: '品牌建设服务',
            requiresAuth: false
        }
    }, {
        path: '/talentcult',
        name: 'talent_cult_page',
        component: () => import('@/pages/talent_cult_page/App.vue'),
        meta: {
            title: '人才培养',
            requiresAuth: false
        }
    }, {
        path: '/creditservices',
        name: 'credit_services_page',
        component: () => import('@/pages/credit_services_page/App.vue'),
        meta: {
            title: '信用服务',
            requiresAuth: false
        }
    }, {
        path: '/finainsur',
        name: 'fina_insur_page',
        component: () => import('@/pages/fina_insur_page/App.vue'),
        meta: {
            title: '金融/保险',
            requiresAuth: false
        }
    }, {
        path: '/netsecurity',
        name: 'net_security_page',
        component: () => import('@/pages/net_security_page/App.vue'),
        meta: {
            title: '网络安全',
            requiresAuth: false
        }
    }, {
        path: '/conferservice',
        name: 'confer_service_page',
        component: () => import('@/pages/confer_service_page/App.vue'),
        meta: {
            title: '会务服务',
            requiresAuth: false
        }
    },
]
const massentreRoutes = [
    {
        path: '/massentre',
        name: 'mass_entre_page',
        component: () => import('@/pages/mass_entre_page/App.vue'),
        meta: {
            title: '双创系统',
            requiresAuth: false
        }
    },{
        path: '/sc_intellComput',
        name: 'sc_intell_comput_page',
        component: () => import('@/pages/sc_intell_comput_page/App.vue'),
        meta: {
            title: '政策服务',
            requiresAuth: false
        }
    },{
        path: '/sc_emplat',
        name: 'sc_empowerment_platform_page',
        component: () => import('@/pages/sc_empowerment_platform_page/App.vue'),
        meta: {
            title: '双创支撑',
            requiresAuth: false
        }
    },{
        path: '/sc_knowhub',
        name: 'sc_know_hub_page',
        component: () => import('@/pages/sc_know_hub_page/App.vue'),
        meta: {
            title: '动态咨询',
            requiresAuth: false
        }
    },{
        path: '/sc_modelhub',
        name: 'sc_model_hub_page',
        component: () => import('@/pages/sc_model_hub_page/App.vue'),
        meta: {
            title: '企业云图',
            requiresAuth: false
        }
    },{
        path: '/sc_applicationscen',
        name: 'sc_application_scen_page',
        component: () => import('@/pages/sc_application_scen_page/App.vue'),
        meta: {
            title: '联系我们',
            requiresAuth: false
        }
    },
]

const router = createRouter({
    // history: createWebHistory(import.meta.env.BASE_URL),
    history: createWebHashHistory(import.meta.env.BASE_URL),//createWebHistory(import.meta.env.BASE_URL),
    routes: [
        ...homeRoutes,
        ...emplatRoutes,
        ...newsConsultationRoutes,
        ...leadershipCareRoutes,
        ...servicecapaRoutes,
        ...massentreRoutes,
    ],
    // 滚动行为配置
    scrollBehavior(to, from, savedPosition) {
        // 保持滚动位置
        if (savedPosition) {
            return savedPosition
        } else {
            // 否则滚动到顶部
            return {top: 0}
        }
    }
})

export default router
